/* SharePoint Console Project
 * Http://SharePointConsole.codeplex.com
 * Copyright Jean-Alain Baeyens (2009)
 * Software under Microsoft Reciprocal License (Ms-RL)
 */

using System.Web.UI.WebControls.WebParts;

using Microsoft.SharePoint;
using Microsoft.SharePoint.WebPartPages;
using Sharepoint.Console.Commands;

namespace Sharepoint.Console.Site
{
    public partial class GetActiveSiteGuid: BaseCommande
    {
        public override string ShortHelp
        {
            get
            {
                return "Get the guid of the site collection";
            }
        }

        public override string LongHelp
        {
            get
            {
                return "Get the guid of the site collection (spSite) previously connected";
            }
        }

        public override string Syntax
        {
            get
            {
                return "GetActiveSiteGuid";
            }
        }

        public override string Execute(string[] args)
        {
            if (args.Length != 1) return string.Format("Invalide syntax. Use {0}", Syntax);


            if (this.SharepointConnection.Site != null)
            {
                return this.SharepointConnection.Site.ID.ToString();
            }
            else
            {
                return "Not connected";
            }
        }
    }
}
